package com.twu.biblioteca;

public class Args {
//        helpText += "find <itemTitle>                # returns items matching the query (Useful for finding IDs)";
//        helpText += "<libraryNumber> <password> userinfo                        # displays user info\n";
//        helpText += "<libraryNumber> <password> checkout <itemID>               # checks out the item to costumer\n";
//        helpText += "<libraryNumber> <password> checkin <itemID>                # checks in the item\n";
//        helpText += "Sample usage:\n";
//        helpText += "$ biblioteca list\n";


    private String command;

    private String itemTitle;
    private int itemID;

    private String libraryNumber;
    private String password;

    private Args(String[] args) {
        if (args.length == 1) {
            this.command = args[0];
        } else if (args.length == 2) {
            this.command = args[0];
            this.itemTitle = args[1];
        } else if (args.length > 2) {
            this.command = args[2];
            this.libraryNumber = args[0];
            this.password = args[1];
            if (args.length == 4) {
                this.itemID = Integer.parseInt(args[3]);
            }
        }
    }

    public static Args parse(String[] args) {
        return new Args(args);
    }

    public String getCommand() {
        return command;
    }

    public String getItemTitle() {
        return itemTitle;
    }


    public int getItemID() {
        return itemID;
    }

    public String getLibraryNumber() {
        return libraryNumber;
    }

    public String getPassword() {
        return password;
    }
}
